<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="<%=basePath%>">
<%@ include file="/base/jsp/include.jsp"%>
<script type="text/javascript">
	var grid;
	
	var view = function(id) {
		parent.sy.modalDialog({
			title : '描述',
			width : 1000,
			height : 600,
			url : sy.contextPath + '/go.do?path=log/logInfo&id='+id
		});
	};

	//删除
	var del = function(id){
		parent.$.messager.confirm('询问', '您确定要删除此记录？', function(r) {
			if (r) {
				$.post(sy.contextPath + '/adminLog/del', {
					id : id
				}, function() {
					grid.datagrid('reload');
				}, 'json');
			}
		});
	};
	
	$(function() {
		grid = $('#grid').datagrid({
			url : sy.contextPath + '/adminLog/list',
			toolbar : '#toolbar',
			singleSelect : false,
			frozenColumns : [ [ {
				width : '100',
				checkbox:true,
				field : 'id',
				align : 'center'
			}] ],
			columns : [ [{
				width : $(this).width() * 0.1,
				title : '来源',
				field : 'source',
				align : 'center',
				formatter : function(v,r,i){
					return v == 1?'操作':'异常';
				}
			},{
				width : $(this).width() * 0.1,
				title : '账号',
				field : 'account',
				align : 'center',
				formatter : function(v,r,i){
					return v;
				}
			},{
				width : $(this).width() * 0.1,
				title : 'IP',
				field : 'ip',
				align : 'center',
				formatter : function(v,r,i){
					return v;
				}
			},{
				width : $(this).width() * 0.1,
				title : '时间',
				field : 'createTime',
				align : 'center',
				formatter : function(v,r,i){
					return v;
				}
			},{
				width : $(this).width() * 0.1,
				title : '名称',
				field : 'content',
				align : 'center',
				formatter : function(v,r,i){
					return sy.stringToJSON(v)['描述'];
				}
			},{
				width : $(this).width() * 0.1,
				title : '操作',
				field : 'ids',
				align : 'center',
				formatter : function(v,r,i){
					var str = '';
					str += "[<a href='javascript:;' onclick=\"view('"+r.id+"')\">查看描述</a>]";
					str += "&nbsp;&nbsp;[<a href='javascript:;' onclick=\"del('"+r.id+"')\">删除</a>]";
					return str;
				}
			}
			] ]
		});
		
	});
	
	
	
</script>
</head>
<body class="easyui-layout" data-options="fit:true,border:false">
	<div id="toolbar" style="display: none;">
		<table>
			<tr style="display: none;">
				<td>
					<form id="searchForm">
						<table>
							
						</table>
					</form>
				</td>
			</tr>
			<tr>
				<td>
					<table>
						<tr>
							
						</tr>
					</table>
				</td>
			</tr>
			
		</table>
	</div>
	<div data-options="region:'center',fit:true,border:false">
		<table id="grid" data-options="fit:true,border:false"></table>
	</div>
</body>
</html>